<%-- 
    Document   : user-profile
    Created on : 09-Jan-2013, 14:37:45
    Author     : Roald
--%>
<%@page import="nl.hva.web.mvcwebapp.models.User"%>
<%@page import="nl.hva.web.mvcwebapp.doa.UserDAO"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="nl.hva.web.mvcwebapp.controllers.UserController"%>
<%-- get user type, only once --%>
<%
    HttpSession session_user = request.getSession(true);
    String firstname = (String) session_user.getAttribute("user_firstname");
    int user_id = 0;
    int user_type = 0;
    String profilepic = null;
    if (firstname != null) {
        user_id = Integer.parseInt("" + session_user.getAttribute("user_id"));
        user_type = Integer.parseInt("" + session_user.getAttribute("user_type"));
        profilepic = (String) session_user.getAttribute("user_profilepicture");
    }

%>

<!--  **************** Multi Language ******************** -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
    session = request.getSession(true);
    String lang = (String) session.getAttribute("lang");
    if (lang == null) {
        //default language if language not set.
        lang = "en";
    }
%>
<fmt:setLocale value="<%=lang%>" />
<fmt:setBundle basename="<%=lang%>" />
<!--  **************** Multi Language END ******************** -->

<% if (firstname != null) {%>
<div class="side-profile">
    <h2><fmt:message key="loggedAs"/> <%=firstname%>!</h2> <br />
    <img style="float:right;" width="100px" height="100px" src="<%=profilepic%>" class="profile-picture">
    <ul style="list-style: none;">
        <li><a class="button" href="${url}/user/user_profile?id=<%=user_id%>"><fmt:message key="profile"/></a></li>        
        <li><a class="button" href="${url}/course/mycourses"><fmt:message key="mycourses"/></a></li>        
        
        <li><a class="button" href="URL" onclick="window.open('<%=request.getContextPath()%>/chat/login', 'venster_naam', 'menubar=0,resizable=1,width=1000,height=500'); return false">Chat</a><br class="clearfix"/></li>        
        <li><a class="right" href="${url}/logout"><fmt:message key="logout"/></a><br class="clearfix"/></li>      
    </ul>
    <br class="clearfix"/>
</div>
<%} else {%>
<div class="side-profile">
    <h2><fmt:message key="welcome"/></h2><br />
    <fmt:message key="notloggedin"/><br class="clearfix"/>

    <a href="${url}/login" title="Log in on Three2Learn" class="button"><fmt:message key="login"/></a>
    <a href="${url}/register" title="Register at Three2Learn" class="button"><fmt:message key="signUp"/></a>
    <br class="clearfix"/>
</div>
<%}%>